package org.brownhouse.rss.torrent;

import java.net.URL;

/**
 * 
 */
public class Torrent {

    private URL torrentUrl;
    private String name;

    public Torrent(URL torrentUrl, String name) {
        this.torrentUrl = torrentUrl;
        this.name = name;
    }

    public URL getTorrentUrl() {
        return torrentUrl;
    }

    public String getName() {
        return name;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Torrent torrent = (Torrent) o;

        if (name != null ? !name.equals(torrent.name) : torrent.name != null) return false;
        if (torrentUrl != null ? !torrentUrl.equals(torrent.torrentUrl) : torrent.torrentUrl != null) return false;

        return true;
    }

    public int hashCode() {
        int result;
        result = (torrentUrl != null ? torrentUrl.hashCode() : 0);
        result = 31 * result + (name != null ? name.hashCode() : 0);
        return result;
    }
}
